<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="材料" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doSave(flag){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		document.getElementById("continue_flag").value=flag;
		frm.submit();
	}
	function doCancel(){
		parent.ClosePop();
	}
	function selectUnit(){
		var url="/base/UnitListForSelect.ihtm";
		ShowIframe("选择单位",url,310,400,"selectUnitCallBack()");
	}
	function selectUnitCallBack(){
		if(popRetVal!=null){
			document.getElementById("product.unit").value=popRetVal[1];
		}
	}
	function showMe(){
		if(checkNavigator()[0]!="msie"){
			document.getElementById("attach_file").className="";
		}
		showFormErrorMsg();
		document.getElementById("product.productName").focus();
	}
</script>
</head>
<body onLoad="showMe();"  class="sheet modal-dialog" style=" padding-top:15px;">
<div class="sheet-main" id="bodyDiv" style="width:860px;">
	<form name="frm" method="post" enctype="multipart/form-data">
	  <div class="sheet-list" style="width:100%">
	    <div class="modal-main search-business">
	    	<div style="width:100%;">
				<c:if test="${id==null || id==''}"><c:set var="pageTopTitle" value="新增材料" /></c:if>
				<c:if test="${id!=null && id!=''}"><c:set var="pageTopTitle" value="编辑材料" /></c:if>
				<%@ include file="../inc/PageTop.jsp"%> 
				<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a2">
					<tr>
				      	<th><span class="MustInput">*</span>编号/条码：</th>
				      	<spring:bind path="command.product.productCode">
				      	<td>
							<c:set var="coseClassStr" value="class='TextBox'" />
				      		<c:if test="${command.codeRule.generateRule!='MANUAL' && command.product.id==0}">
				      			<c:set var="codeDisabledStr" value="disabled" />
								<c:set var="coseClassStr" value="class='TextBox readonly'" />
				      		</c:if>
							<input type="text" maxlength="15" onKeyUp="goNextInput('product.productName');" id="${status.expression}" name="${status.expression}" value="${status.value}" ${codeDisabledStr} ${coseClassStr}>
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',1,'product.productCode');
					          </script>
				     	</td>
				     	</spring:bind>
				      	<th><span class="MustInput">*</span>品名规格：</th>
				     	<spring:bind path="command.product.productName">
				     	<td style="width:20%">
				     		<input type="text"  class="TextBox" maxlength="100" onKeyUp="goNextInput('product.unit');" id="${status.expression}" name="${status.expression}" value="<c:out value="${status.value}" />">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',2,'product.productName');
					          </script>
				     	</td>
				     	</spring:bind>
				    	<th><span class="MustInput">*</span>计量单位：</th>
				    	<spring:bind path="command.product.unit">
				    	<td>
							<input type="text" class="TextBox" maxlength="10" onKeyUp="goNextInput('product.minLimit');" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<img src="/images/icon_add.gif" style="cursor:pointer;" onClick="selectUnit();">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',5,'product.unit');
					          </script>
				    	</td>
				    	</spring:bind>
					</tr>
					<tr>
				    	<th><span class="MustInput">*</span>类别：</th>
				    	<spring:bind path="command.product.productTypeId">
				    	<td>
				    		<select id="${status.expression}" name="${status.expression}" style="width:150px">
								<option value="0">==请选择==</option>
				  				<commonTag:createSelectTree list="${productTypeList}" emptyOption="0" defaultValue="${status.value}" />
				  			</select>
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',9);
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th><span class="MustInput">*</span>最低库存：</th>
				    	<spring:bind path="command.product.minLimit">
				      	<td>
				      		<input type="text"  class="TextBox" maxlength="15" onKeyUp="goNextInput('product.maxLimit');" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<c:if test="${status.errorCode=='typeMismatch'}">
							  <script language="javascript">
								setFormErrorMsg('最低库存只能输入数字',10,'product.minLimit');
							  </script>
							</c:if>
				     	</td>
				     	</spring:bind>
				    	<th><span class="MustInput">*</span>最高库存：</th>
				    	<spring:bind path="command.product.maxLimit">
				      	<td>
				      		<input type="text"  class="TextBox" maxlength="15" onKeyUp="goNextInput('product.mark');" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<c:if test="${status.errorCode=='typeMismatch'}">
							  <script language="javascript">
								setFormErrorMsg('最高库存只能输入数字',11,'product.maxLimit');
							  </script>
							</c:if>
				     	</td>
				     	</spring:bind>
					</tr>
					
					<tr>
						<th>图片：</th>			    	
				    	<td colspan="3">
				    		<input type="file" class="TextBox" style="width:400px" name="attach_file" id="attach_file">
							<c:if test="${command.product.attachFile!=null && command.product.attachFile!=''}">
								<a href="${command.product.attachFile}" target="_blank">查看</a>
							</c:if>
							<spring:bind path="command.product.attachFile">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',15);
						          </script>
					      	</spring:bind>
				    	</td>
						<th>&nbsp;</th>
				    	<td>&nbsp;</td>
				    </tr>
					
					<tr>
				    	<th>备注：</th> 
				    	<spring:bind path="command.product.mark">
				    	<td colspan="5">
				    		<textarea style="width:660px;height:80px" id="${status.expression}" name="${status.expression}">${status.value}</textarea>
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',16,'product.mark');
					          </script>
				    	</td>
				    	</spring:bind>
				    </tr>
				</table>
			</div>
	  	</div>
	  </div>
		<div class="modal-buttom" id="buttonDiv">
			<input type="button" class="buttom-a" value=" 保 存 " onClick="doSave('0');">
			<input type="button" class="buttom-a" value="保存并新增" onClick="doSave('1');">
			<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();">
			<input type="hidden" name="continue_flag" id="continue_flag" value="0">
		</div>
		<div class="modal-buttom" id="waitDiv" style="display:none">
			<span style="color:#ffffff">请稍候...</span>
		</div>
	</form>
</div>		
</body>
</html>